package cate.common.table.limittimegift;

import cate.common.table.ERow;
import cate.common.table.XSSFRowWrap;
import cate.common.table.conditiontask.ConditionTIdRow;
import easy.java.dev.note.NoteField;

public class LimitTimeGiftRow extends ConditionTIdRow {

    @NoteField(value = "礼包名称")
    public String name;

    @NoteField(value = "奖励")
    public String rewardStr;

    @NoteField(value = "价格")
    public int rmb;

    @NoteField(value = "道具价格")
    public String propPrice;

    @NoteField(value = "持续小时数")
    private long hour;

    @NoteField(value = "限购数量")
    public int limitNum;

    @NoteField(value = "推送等级下限")
    public int levelMin;

    @NoteField(value = "推送等级上限")
    public int levelMax;

    @NoteField(value = "vip等级下限")
    public int vipMin;

    @NoteField(value = "vip等级上限")
    public int vipMax;

    @NoteField(value = "充值项ID")
    public int payItemId;

    @NoteField(value = "开服天数起始")
    public int startDay;

    @NoteField(value = "开服天数结束")
    public int endDay;

    @NoteField(value = "CD时间")
    public long cd;

    @NoteField(value = "前置礼包id", detail = "该弹当前礼包，往前追溯至没买的礼包")
    public int preTid;

    @NoteField(value = "循环类型", detail = "前置礼包重置用")
    public int cycleType;

    @Override
    public void parse(XSSFRowWrap xr) {
        this.id = xr.getInteger("ID", -1);
        this.tid = xr.getInteger("ID", -1);
        this.name = xr.getString("礼包名称");
        this.rewardStr = xr.getString("奖励");
        this.conditionId = xr.getInteger("条件ID");
        this.rmb = xr.getInteger("价格", 0);
        this.propPrice = xr.getString("道具价格", "");
        this.hour = xr.getLong("展示小时数", 0L);
        this.limitNum = xr.getInteger("限购数量", 1);
        this.levelMin = xr.getInteger("推送等级下限", 0);
        this.levelMax = xr.getInteger("推送等级上限", 999);
        this.vipMin = xr.getInteger("vip等级下限", 0);
        this.vipMax = xr.getInteger("vip等级上限", 999);
        this.startDay = xr.getInteger("开服天数", 0);
        this.endDay = xr.getInteger("关闭天数", 999);
        this.payItemId = xr.getInteger("充值项ID", -1);
        this.cd = xr.getLong("CD", 0L);
        this.preTid = xr.getInteger("前置礼包", -1);
        this.cycleType = xr.getInteger("循环类型", -1);
    }

    /**
     * 礼包持续时间
     */
    public long packDuration;

    @Override
    public void decode() {
        packDuration = 3600 * 1000 * hour;
    }
}
